<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>样式绑定类</title>
    <script src="../../js/vue3.js"></script>
    <style>
        p {
            background-color: lightgray;
        }
        
        .class_1 {
            color: red;
        }
        
        .class_2 {
            color: yellow;
        }
        
        .class_3 {
            color: blue;
        }
        
        .class_4 {
            color: green;
        }
    </style>
</head>

<body>
    <div id="app">
        <p v-bind:class="{class_1:yes}">示例文字</p>
        <p v-bind:class="{class_2:no}">示例文字</p>
        <p v-bind:class="['class_3']">示例文字</p>
        <p v-bind:class="['class_4']">示例文字</p>
    </div>
    <script>
        const v_app = Vue.createApp({
            data() {
                return {
                    yes: true,
                    no: false,
                }
            }
        });
        v_app.mount("#app");
    </script>
</body>

</html>